<!DOCTYPE html>
<html xmlns:javascript="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<head>
    <title></title>
    <#include "/header.html">
    <style>
          .bg-purple-light {
            background: #e5e9f2;
          }
          .el-radio-group{
              vertical-align: baseline;
          }
        .el-radio__inner{
            display: none;
        }
    </style>
</head>

<body>
<div id="rrapp" v-cloak>
    <!--图文宝订单列表-->
        <el-row style="height: 20px">
            <el-col :span="9">
                <div class="grid-content bg-purple">
                <span style="font-weight: bold;color: #409EFF">订单状态:</span>
                    <el-radio-group v-model="q.productionStatus" @change="query" >
                        <el-radio :label="''">全部</el-radio>
                        <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">待审核</el-radio>
                        <el-radio :label="3" style="padding-left: 0px;margin-left: 10px">生产中</el-radio>
                        <el-radio :label="4" style="padding-left: 0px;margin-left: 10px">生产完成</el-radio>
                        <el-radio :label="6" style="padding-left: 0px;margin-left: 10px">已完成</el-radio>
                        <el-radio :label="11" style="padding-left: 0px;margin-left: 10px">取消</el-radio>
                    </el-radio-group>
                </div>
            </el-col>
            <el-col :span="6">
                <div class="grid-content bg-purple">
                <span style="font-weight: bold;color: #409EFF">订单来源:</span>
                    <el-radio-group v-model="q.orderSource" @change="query" >
                        <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                        <el-radio :label="2" style="padding-left: 0px;margin-left: 10px">门店订单</el-radio>
                        <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">商城订单</el-radio>
                    </el-radio-group>
                </div>
            </el-col>
            <el-col :span="9">
                <el-row>
                    <el-col :span="9"><span style="font-weight: bold;color: #409EFF">订单统计:</span>&nbsp;当天新订单:{{totalCount.dayCount}}</el-col>
                    <el-col :span="7">
                        <span>当月新订单:{{totalCount.monthCount}}</span>
                    </el-col>
                    <el-col :span="8">
                        <span>当年新订单:{{totalCount.yearCount}}</span>
                    </el-col>
                </el-row>
            </el-col>
        </el-row>
        <el-row style="height: 20px">
            <el-col :span="9">
                <span style="font-weight: bold;color: #409EFF">付款状态:</span>
                    <el-radio-group v-model="q.payStatus" @change="query">
                        <el-radio :label="''" >全部</el-radio>
                        <el-radio :label="'0'" style="padding-left: 0px;margin-left: 10px">未付款</el-radio>
                        <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">已收银</el-radio>
                    </el-radio-group>
            </el-col>
            <el-col :span="6">
                        <span style="font-weight: bold;color: #409EFF">发货状态:</span>
                            <el-radio-group v-model="q.shipStatus" @change="query" >
                                <el-radio :label="''" style="padding-left: 0px;margin-left: 10px">全部</el-radio>
                                <el-radio :label="'0'" style="padding-left: 0px;margin-left: 10px">未发货</el-radio>
                                <el-radio :label="1" style="padding-left: 0px;margin-left: 10px">已发货</el-radio>
                            </el-radio-group>
            </el-col>
            <el-col :span="9">
                <el-row>
                    <el-col :span="9"><span style="font-weight: bold;color: #409EFF">销售统计:</span>&nbsp;当天新销售:{{totalCount.dayMoney}}</el-col>
                    <el-col :span="7">
                        <span>当月新销售:{{totalCount.monthMoney}}</span>
                    </el-col>
                    <el-col :span="8">
                        <span>当年新销售:{{totalCount.yearMoney}}</span>
                    </el-col>
                </el-row>
            </el-col>
        </el-row>
      <!--  <el-row>
        <el-col :span="11"><div class=" grid-content bg-purple-light">
            <el-row>
                <div style="text-align: center;color: red;font-size:20px;font-weight:bold" >订单统计:</div>
                <div style="text-align: center;margin-top: 5px">
                <el-col :span="8">
                    <span style="font-size:17px">当天新订单:{{totalCount.dayCount}}</span>
                </el-col>
                <el-col :span="8">
                    <span style="font-size:17px">当月新订单:{{totalCount.monthCount}}</span>
                </el-col>
                <el-col :span="8">
                    <span style="font-size:17px">当年新订单:{{totalCount.yearCount}}</span>
                </el-col>
                </div>
            </el-row>
            </div>
        </el-col>
        <el-col :span="11" :offset="1"><div class=" grid-content bg-purple-light">
                <el-row>
                    <div style="text-align: center;color: red;font-size:20px;font-weight:bold" >销售统计:</div>
                    <div style="text-align: center;margin-top: 5px">
                    <el-col :span="8">
                        <span style="font-size:17px">当天新销售:{{totalCount.dayMoney}}</span>
                    </el-col>
                    <el-col :span="8">
                        <span style="font-size:17px">当月新销售:{{totalCount.monthMoney}}</span>
                    </el-col>
                    <el-col :span="8">
                        <span style="font-size:17px">当年新销售:{{totalCount.yearMoney}}</span>
                    </el-col>
                    </div>
                </el-row>
            </div>
        </el-col>
        </el-row>
        <el-row >
                <el-col :span="5">
            <span style="color: #1ab7ea;">订单状态:</span>
                <el-select v-model="q.productionStatus" placeholder="请选择" size="small" @change="query" style="width:60%">
                    <el-option
                            v-for="item in e.twbProductionStatusEnum"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-col>
                <el-col :span="5">
                    <span style="color: #1ab7ea">订单来源:</span>
                    <el-select v-model="q.orderSource" placeholder="请选择" size="small" @change="query" style="width:60%">
                        <el-option
                                v-for="item in e.twbOrderSourceEnum"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-col>
                <el-col :span="5">
                    <span style="color: #1ab7ea">付款状态:</span>
                    <el-select v-model="q.payStatus" placeholder="请选择" size="small" @change="query" style="width:60%">
                        <el-option
                                v-for="item in e.twbPayStatusEnum"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-col>
                <el-col :span="5">
                    <span style="color: #1ab7ea">发货状态:</span>
                    <el-select v-model="q.shipStatus" placeholder="请选择" size="small" @change="query" style="width:60%">
                        <el-option
                                v-for="item in e.twbShipStatusEnum"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-col>
                &lt;!&ndash;<el-col :span="4">

                </el-col>&ndash;&gt;
        </el-row>-->
        <el-row style="height: 20px" >
        <!--查询-->
        <el-input placeholder="订单号" size="small" clearable  v-model.trim="q.orderNo" style="width:180px" @keyup.enter.native="query">
        </el-input>
            <el-input placeholder="客户名称" size="small" clearable  v-model.trim="q.memberName" style="width:100px" @keyup.enter.native="query">
            </el-input>
            <el-input placeholder="项目名称" size="small" clearable  v-model.trim="q.projectName" style="width:130px" @keyup.enter.native="query">
            </el-input>
                <el-date-picker
                        size="small"
                        style="width: 300px"
                        v-model="q.createTime"
                        type="daterange"
                        align="right"
                        value-format="yyyy-MM-dd"
                        unlink-panels
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
                </el-date-picker>
        <el-button  type="primary" @click="query" plain size="small" icon="el-icon-search">查询</el-button>
        <el-button  type="primary" @click="reset"  plain size="small" icon="el-icon-refresh">重置</el-button>
        </el-row>
        <el-row  >
            <el-button type="primary" plain size="small" icon="el-icon-plus" @click="add" v-show="q.orderSource!=1">新增订单</el-button>
            <el-button type="primary" plain size="small" icon="el-icon-edit" @click="update" v-show="q.orderSource!=1">修改订单</el-button>
            <el-button type="warning" plain size="small" icon="el-icon-delete" @click="openCancelDialog" v-show="q.orderSource!=1">取消订单</el-button>
            <el-button type="success" plain size="small" icon="el-icon-success" @click="finishOrderItem">生产完成</el-button>
            <el-button type="primary" plain size="small" icon="el-icon-sold-out" @click="addLogistic">添加物流</el-button>
            <el-button type="primary" plain size="small" icon="el-icon-check" @click="batchAudit" v-show="q.orderSource!=2">批量审核</el-button>
            <el-button type="danger" plain size="small" icon="el-icon-tickets" @click="openReceviceMoney" v-show="q.orderSource!=1">订单收银</el-button>
            <el-button type="primary" plain size="small" icon="el-icon-printer" @click="print">打印</el-button>
        </el-row>

        <!--订单列表-->
        <el-table size="mini" :data="orderData"
                  ref="orderTable"
                  highlight-current-row
                  @row-click="clickRow"
                  :header-cell-style="{'text-align':'center'}"
                    :cell-style="{'text-align':'center'}"
                    @selection-change="handleOrderSelection"
                  border style="width: 99%;margin-top: 20px">
            <el-table-column type="index" label="序号"></el-table-column>
            <el-table-column
                    type="selection"
                    width="55">
            </el-table-column>
            <el-table-column type="expand">
                <template slot-scope="props" >
                    <el-table
                            size="small"
                            :data="props.row.erpOrderItemEntityList"
                            style="width: 100%">
                        <el-table-column
                                type="index"
                                width="50"
                                label="序号">
                        </el-table-column>
                        <el-table-column label="商品名称" prop="name" ></el-table-column>
                        <el-table-column label="规格/尺寸/材质/工艺"    prop="addon"></el-table-column>
                        <el-table-column label="数量"    prop="nums"></el-table-column>
                        <el-table-column label="份数"    prop="copy"></el-table-column>
                        <el-table-column label="单价"    prop="price"></el-table-column>
                        <el-table-column label="总价"    prop="amount"></el-table-column>
                        <el-table-column label="备注"    prop="itemRemark"></el-table-column>
                    </el-table>
                </template>
            </el-table-column>
            <el-table-column prop="orderNo" label="订单号"  >
                <template slot-scope="scope">
                    <a href="javascript:;" @click="twbOrderVm.erpOrderDetail(scope.row.orderNo)">{{scope.row.orderNo}}</a>
                    <!--<a href="javascript:;" onclick="return this.erpOrderDetail(\''+scope.row.orderNo +'\');">'+ scope.row.orderNo +'</a>-->
                    <!--<el-button
                            size="small"
                            type="text"
                            @click="erpOrderDetail(scope.$index, scope.row.orderNo)">{{scope.row.orderNo}}</el-button>-->
                </template>
            </el-table-column>

            <el-table-column prop="memberName" label="客户名称"></el-table-column>

            <el-table-column prop="productionStatus" label="生产状态"  width="80">
                <template slot-scope="scope">
                    <span style="color: #00c0ef" v-show="scope.row.productionStatus==1">待审核</span>
                    <span style="color: #00ca6d" v-show="scope.row.productionStatus==4">生产完成</span>
                    <span style="color: red" v-show="scope.row.productionStatus==6">已完成</span>
                    <span v-show="scope.row.productionStatus==3">生产中</span>
                    <span v-show="scope.row.productionStatus==11">已作废</span>
                </template>
            </el-table-column>

            <el-table-column prop="payStatus" label="付款状态" :formatter="formatterPayStatus" width="80"></el-table-column>

            <el-table-column prop="totalAmount" label="订单金额"  width="100"></el-table-column>

            <el-table-column prop="payableAmount" label="应付金额"  width="100"></el-table-column>

            <el-table-column prop="orderSource" label="订单来源" :formatter="formatterOrderSourceStatus" width="100"></el-table-column>

            <el-table-column prop="orderCreatetime" label="下单时间"></el-table-column>

            <el-table-column prop="shipName" label="收货人"></el-table-column>

            <el-table-column prop="shipMobile" label="联系方式" width="100"></el-table-column>

            <el-table-column prop="shipAddr" label="地址"></el-table-column>

            <el-table-column prop="projectName" label="项目名称"></el-table-column>

        </el-table>

        <!--分页插件-->
        <div style="text-align: center;margin: 15px">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="page.currentPage"
                    :page-sizes="page.pageSizes"
                    :page-size="page.pageSize"
                    layout="total, sizes, prev, pager, next"
                    :total="page.total">
            </el-pagination>
        </div>

    <!--取消订单dialog开始-->
    <el-dialog
            title="取消订单"
            :visible.sync="cancelOrderVisible"
            width="20%"
    >
        <div>
            <el-input disabled v-model="erpOrderLogs.orderNo" size="small">
                <template slot="prepend">订单号：</template>
            </el-input>
        </div>
        <div style="margin-top: 10px">
            取消原因：
            <el-input v-model="erpOrderLogs.logText" size="small"  :rows="3" type="textarea" autosize>
            </el-input>
        </div>
        <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="cancelOrder" size="small">确 定</el-button>
  </span>

    </el-dialog>
    <!--取消订单dialog结束-->

    <!--打印dialog开始-->
    <el-dialog
            title="打印"
            :visible.sync="printVisible"
            width="20%"
        >
        <div style="text-align: center">
            <el-button type="primary" @click="printProduct">生产单</el-button>
            <el-button type="primary" @click="printSend">结算送货单</el-button>
        </div>
        </span>

    </el-dialog>
    <!--打印dialog结束-->
    <zy-print-production  ref="zyPrintProduction">
        打印生产单组件
    </zy-print-production>
    <zy-print-final  ref="zyPrintFinal">
        打印结算清单组件
    </zy-print-final>
</div>
<#include "/modules/order/updateTwbOrder.html">
<#include "/modules/order/twbCollectMoney.html">
<#include "/modules/order/twbLogistic.html">

<script src="${request.contextPath}/statics/js/modules/printtwb/printProductionComponent.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/js/modules/printtwb/printFinalComponent.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/js/modules/order/twbOrder.js?_${.now?long}"></script>
</body>
</html>